<?php

class SpecialContent extends AppModel {

    var $alias = 'SpecialContent';
    var $name = 'SpecialContent';
    var $useTable = 'special_content';

    function paginateCount($conditions = null, $recursive = 0, $extra = array()) {
        $parameters = compact('conditions');
        $this->recursive = $recursive;
        $count = $this->find('count', array_merge($parameters, $extra));
        if (isset($extra['group'])) {
            $count = $this->getAffectedRows();
        }
        return $count;
    }

    function cacheList($limit = 4) {
        $conditions = array(
            'SpecialContent.published' => 1,
        );
        $cacheName = 'special_content_list';
        $data = $this->find('all', array(
                    'fields' => array('SpecialContent.alias,SpecialContent.id,SpecialContent.short_content,SpecialContent.title,SpecialContent.thumbnail'),
                    'conditions' => $conditions,
                    'order' => array(
                        'SpecialContent.ordering' => 'DESC'
                    ),
                ));
        Cache::write($cacheName, $data, 'special_content');
    }

}

?>
